<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<f:view>
	<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"  
  xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
			<title>Insert title here</title>
			<STYLE type="text/css">
			<!--
			.titre {
			background-color:#000000;
			color:#FFFFFF;
			}
			.paire {
			background-color:#EFEFEF;
			}
			.impaire {
			background-color:#CECECE;
			}
			-->
			</STYLE>
		</head>
		<body>
		<h:form  id="myForm">
		<h2 style="text-align: center">Bienvenu Admin</h2>
		<table background="#EFEFEF">
			<tr>  <td>
			    
			     <!-- boutton de navigation -->
				<h:commandButton value="Deconnexion" action="Deconnexion" style="width: 100px"></h:commandButton>
			    <h:commandButton  value="Ajouter" action="#{UserBo.createUserBo}"  style="width: 100px"  type="submit" />
			    
			    <!-- messages de validation des inputs --> 
			    <h:message for="log" style="color:red" ></h:message>
			    <h:message for="nom" style="color:red" ></h:message>
			    <h:message for="prenom" style="color:red"></h:message>
			    <h:message for="ip" style="color:red"></h:message>
			    <h:message for="dns_Comput" style="color:red"></h:message>
			     
			     <!-- Formulaire d'ajout d'un nouveau utilisateur --> 
			    <h:panelGrid  border="1" columns="8" style="width: 915px" columnClasses="paire">	
					<h:outputLabel for="nom" value="nom" style='font-size: 14px; font-family: "Times New Roman;", Serif' />
					<h:inputText id="nom" value="#{UserBo.nom_createUser}" style="width: 100px" />
					<h:outputLabel for="prenom" value="prenom" style='font-size: 14px; font-family: "Times New Roman", Serif' />				
				    <h:inputText value="#{UserBo.prenom_createUser}" id="prenom" style="width: 100px"></h:inputText>
					<h:outputLabel for="Log" value="Login" style='font-size: 14px; font-family: "Times New Roman", Serif' />	
				    <h:inputText id="log" value="#{UserBo.login_createUser}" validator="#{validation.validateEmail}" style="width: 100px" />
					<h:outputLabel for="pass" value="password" style='font-size: 14px; font-family: "Times New Roman", Serif' />
					<h:inputText value="#{UserBo.password_createUser}" id="pass" style="width: 100px" />
					<h:outputLabel for="name_Comput" value="Name Computer" style='font-size: 14px; font-family: "Times New Roman", Serif' />
				    <h:inputText value="#{UserBo.name_Computer}" id="name_Comput" style="width: 100px" />
					<h:outputLabel for="ip"value="ipadresse Computer" style='font-size: 14px; font-family: "Times New Roman", Serif' />
					<h:inputText value="#{UserBo.ipadresse_Computer}"  validator="#{validation.ipadresse}" id="ip" style="width: 100px" />
					<h:outputLabel for="dns_Comput" value="dns Computer"style='font-size: 14px; font-family: "Times New Roman", Serif' />
					<h:inputText value="#{UserBo.dns_Computer}" id="dns_Comput" style="width: 100px" />
				 </h:panelGrid>
			</td>
			</tr>
		</table>
	     <!-- Affichage de la liste des utilisateur --> 
		<h:dataTable binding="#{UserBo.dataTable}" value="#{UserBo.pers}" var="data" cellspacing="4"  rowClasses="paire,impaire" headerClass="titre" style="width: 924px">
                  <h:column>
                  <f:facet name="header">
     			  	<h:outputText value="Fname" />
    			  </f:facet>
                  	<h:outputText value="#{data.user.fnameUser}" style="width: 65px"  rendered="#{not data.editable}"/>
					<h:inputText value="#{data.user.fnameUser}" style="width: 110px" rendered="#{data.editable}"/>
                  </h:column>
                  
                  <h:column>
                  <f:facet name="header">
     				 <h:outputText value="Name" />
    			  </f:facet>
                  	<h:outputText value="#{data.user.nameUser}" style="width: 65px"  rendered="#{not data.editable}"/>
					<h:inputText value="#{data.user.nameUser}" style="width: 110px" rendered="#{data.editable}"/>
                  </h:column>
                  
                  <h:column>
                  <f:facet name="header">
     				 <h:outputText value="Login" />
    			  </f:facet>
                  	 <h:outputText value="#{data.user.loginUser}" style="width: 65px"  rendered="#{not data.editable}"/>
					<h:inputText value="#{data.user.loginUser}" style="width: 110px" rendered="#{data.editable}"/>
                  </h:column>
                  
                  <h:column>
                  <f:facet name="header">
     				 <h:outputText value="Passeword" />
    			  </f:facet>
                    <h:outputText value="#{data.user.passewordUser}" style="width: 65px"  rendered="#{not data.editable}"/>
						<h:inputText value="#{data.user.passewordUser}" style="width: 110px" rendered="#{data.editable}"/>
                  </h:column>
                  
                   <h:column>
                  <f:facet name="header">
     				 <h:outputText value="Passeword" />
    			  </f:facet>
                    <h:outputText value="#{data.computer.nameComputer}" style="width: 65px"  rendered="#{not data.editable}"/>
						<h:inputText value="#{data.computer.nameComputer}" style="width: 110px" rendered="#{data.editable}"/>
                  </h:column>                
			      
			       <h:column>
                  <f:facet name="header">
     				 <h:outputText value="Passeword" />
    			  </f:facet>
                    <h:outputText value="#{data.computer.ipadresseComputer}" style="width: 65px"  rendered="#{not data.editable}"/>
						<h:inputText value="#{data.computer.ipadresseComputer}" style="width: 110px" rendered="#{data.editable}"/>
                  </h:column>   
			      
			       <h:column>
                  <f:facet name="header">
     				 <h:outputText value="Passeword" />
    			  </f:facet>
                    <h:outputText value="#{data.computer.dnsComputer}" style="width: 65px"  rendered="#{not data.editable}"/>
						<h:inputText value="#{data.computer.dnsComputer}" style="width: 110px" rendered="#{data.editable}"/>
                  </h:column>   
			      <h:column>
            	  <f:facet name="header">
               		 <h:outputText value="Test" />
            	   </f:facet>
            	     <h:commandLink value="Ping" action="#{UserBo.editDataItem}" />
       			  </h:column>
       			  
       			  <h:column>
            	  <f:facet name="header">
               		 <h:outputText value="Delet" />
            	  </f:facet>
            	     <h:commandLink value="Delet" action="#{UserBo.DeletDataItem}" />
       			  </h:column>
       			   <h:column>
            	  <f:facet name="header">
               		 <h:outputText value="Update" />
            	  </f:facet>
            	      <h:commandLink value="Update" action="#{UserBo.Update}" rendered="#{not data.editable}" />
            	      <h:commandLink value="Save" action="#{UserBo.Save}" rendered="#{data.editable}" />
       			  </h:column>		
		</h:dataTable><br><br>
		</h:form>
		</body>
	</html>
</f:view>